//
//  GFNetWorkingTools.m
//  lib.utils
//
//  Created by 胡林虎 on 2017/6/30.
//  Copyright © 2017年 胡林虎. All rights reserved.
//
/*
     全URL请求: 无法区分GET/POST
               默认是GET 0
*/


#import "GFNetWorkControl.h"
#import "GFBaseNetWork.h"

@implementation GFNetWorkControl

//get post请求
+ (void)requestURL:(NSString*)url
          hostType:(HostStatusStyles)hostType
            parmas:(NSDictionary*)dic
cacheTimeInSeconds:(NSInteger)cacheTime
    requestSuccess:(SucessBlock)sucessBlock
     requestFailed:(FailedBlock)failedBlock {
    
    [GFBaseNetWork requestURL:url hostType:hostType parmas:dic cacheTimeInSeconds:cacheTime requestSuccess:sucessBlock requestFailed:failedBlock];

}


//先加载缓存后请求
+ (void)requestFromCacheURL:(NSString *)url
                   hostType:(HostStatusStyles)hostType
                     parmas:(NSDictionary *)dic
             requestSuccess:(SucessBlock)sucessBlock
              requestFailed:(FailedBlock)failedBlock {

    [GFBaseNetWork requestFromCacheURL:url hostType:hostType parmas:dic requestSuccess:sucessBlock requestFailed:failedBlock];

}

//图片上传
+ (void)uploadImage:(NSString *)url
           hostType:(HostStatusStyles)hostType
            paramas:(NSDictionary *)dic
              image:(UIImage *)image
     requestSuccess:(SucessBlock)sucessBlock
      requestFailed:(FailedBlock)failedBlock {
    
    [GFBaseNetWork uploadImage:url hostType:hostType paramas:dic image:image requestSuccess:sucessBlock requestFailed:failedBlock];

}

//带toast的网络请求
+ (void)requestURLWithToast:(NSString*)url
                   hostType:(HostStatusStyles)hostType
                     parmas:(NSDictionary*)dic
         cacheTimeInSeconds:(NSInteger)cacheTime
                  needToast:(BOOL)needToast
             requestSuccess:(SucessBlock)sucessBlock
              requestFailed:(FailedBlock)failedBlock {
    
    [GFBaseNetWork requestURLWithToast:url hostType:hostType parmas:dic cacheTimeInSeconds:cacheTime needToast:needToast requestSuccess:sucessBlock requestFailed:failedBlock];
}

@end
